/**
 * 环境配置
 */

import Constants from 'expo-constants';

// 判断是否为开发环境
const isDevelopment = __DEV__;

// 判断是否为Expo开发环境
const isExpoGo = Constants.appOwnership === 'expo';

// API配置
export const ENV_CONFIG = {
  // 开发环境配置
  development: {
    API_BASE_URL: 'http://39.106.229.5:6039',
    TIMEOUT: 10000,
    AI_CHAT_TIMEOUT: 60000,
  },

  // 生产环境配置
  production: {
    API_BASE_URL: 'http://39.106.229.5:6039', // 生产环境建议使用HTTPS
    TIMEOUT: 15000,
    AI_CHAT_TIMEOUT: 60000,
  }
};

// 当前环境配置
export const CURRENT_ENV = isDevelopment ? ENV_CONFIG.development : ENV_CONFIG.production;

// 导出配置
export const API_CONFIG = {
  BASE_URL: CURRENT_ENV.API_BASE_URL,
  TIMEOUT: CURRENT_ENV.TIMEOUT,
  AI_CHAT_TIMEOUT: CURRENT_ENV.AI_CHAT_TIMEOUT,
  HEADERS: {
    'Content-Type': 'application/json',
    'Accept-Language': 'zh-HK',
  },
};

// 调试信息
console.log('Environment Info:', {
  isDevelopment,
  isExpoGo,
  apiBaseUrl: API_CONFIG.BASE_URL,
  platform: Constants.platform,
});

export default API_CONFIG;
